import {getLists} from '../Utils/services/api'
export default{
    namespace:'search',
    state:{
        text:'dva',
        list:[]
    },
    // 同步方法
    reducers:{
        getLists(state:object,action:any){
            return {
                ...state,
                list:action.payload.List
            }
        }
    },
    // 异步方法
    effects:{
        *getListsAsync({payload}:any,{call,put}:any){
            const res = yield call(getLists,payload)
            yield put({
                type:'getLists',  //  同步中的方法名
                payload:res
            })
        }
    }
}